package cn.hairui.blog.service.impl;

import cn.hairui.blog.model.Book;
import cn.hairui.blog.repository.BookRepository;
import cn.hairui.blog.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author lihairui
 * @version V1.0
 * @date: 2019/7/28 22:15
 */
@Service(value = "bookService")
public class BookServiceImpl implements BookService {

    @Autowired
    private BookRepository bookRepository;

    @Override
    public List<Book> findLimited(int start, int end) {
        return bookRepository.findLimited(start, end);
    }

    @Override
    public Book find(int id) {
        return bookRepository.find(id);
    }

    @Override
    public List<Map> listMgr() {
        return bookRepository.listMgr();
    }

    @Override
    public int add(Book book) {
        return bookRepository.add(book);
    }

    @Override
    public List<Book> findByBookName(String bookName) {
        return bookRepository.findByBookName(bookName);
    }

    @Override
    public void delete(int id) {
        bookRepository.delete(id);
    }

    @Override
    public List<Book> list() {
        return bookRepository.list();
    }

    @Override
    public void updateCover(Integer id, String fileName) {
        bookRepository.updateCover(id, fileName);
    }
}
